#include <unistd.h>  
#include <stdio.h>  
int main(void)  
{  
    pid_t pid_f;
    int count = 0;
    printf("pid of main = %d\n", getpid());

    /*  返回的两个值
        对于主进程来说返回的是子进程的pid
        对于子进程来说返回是0  */
    pid_f = fork();
    if(pid_f > 0){
        count++;
        printf("我是父进程, count = %d\n", count);
        printf("我是父进程, pid = %d pid_f = %d\n", getpid(), pid_f);
    }else{
        count++;
        printf("我是子进程, count = %d\n", count);
        printf("我是子进程, pid = %d pid_f = %d\n", getpid(), pid_f);
    }

    return 0;  
}  
